<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/view/common/taglibs.jsp"%>
<!DOCTYPE html>
<html>
<meta charset="utf-8">
<head>
<title>${appname}-<c:if test="${!empty sessionScope._local_node_session}">${sessionScope._local_node_session.nodeName}-</c:if>${si:ctname("NET_TYPE",sessionScope._netType)}</title>
<%@ include file="/WEB-INF/view/common/css_js_ace.jsp"%>
<script type="text/javascript">
$(function(){
	$('.tipMe').tooltip({'placement':'top'});
})

function submit(){
	$("#searchForm").submit();
}
function search(form) {
    $(form).appendPagerParaStr();
    return true;
}
function deleteById(id){
	ui.confirm('确认删除?',function(){
		$.ajax({
			   type: "POST",
			   dataType:"json",
			   cache: false,
			   url: _ctx + "/registry/domain_info_delete.do",
			   data: {id:id},
			   success: function(resp){
				   if(resp.status == '1'){
					   ui.msg(resp.msg, 1);
					   ui.go(_ctx + '/registry/domain_info_list.do');
				   }else{
					   ui.msg(resp.msg, 0);
				   }
			   },
			   error:function(){
				   ui.msg('信息加载错误', 0);
			   }
		});
	});	
}
/**
批量删除
**/
function batchDelete(){
	var ids = $("input[name='ids']:checked");//jquery语法，选择页面中所有input表单中name=ids且被选中的值
	if(ids.length == 0){
		alert('请选择要删除的记录!');
		return;
	}	
	
	var validIds = new Array();
	var idAndStatus = null;
	var id = null;
	var status = null;
	for(var i=0;i<ids.length;i++){
		validIds.push($(ids[i]).val());
	}
	var idsVal = "";
	for(var i=0;i<validIds.length;i++){
		idsVal += validIds[i] +",";
	}
	idsVal = idsVal.substring(0,idsVal.length - 1);
	ui.confirm('确认删除?',function(){
		$.ajax({
			   type: "POST",
			   dataType:"json",
			   cache: false,
			   url: _ctx + "/registry/batch_domain_info_delete.do",
			   data: {"ids":idsVal},
			   success: function(resp){
				   if(resp.status == '1'){
					   ui.msg(resp.msg, 1);
					   ui.go(_ctx + '/registry/domain_info_list.do');
				   }else{
					   ui.msg(resp.msg, 0);
				   }
			   },
			   error:function(){
				   ui.msg('信息加载错误', 0);
			   }
		});
	});	
}
function domainInfoGet(id){
	$.ajax({
		   type: "GET",
		   dataType:"html",
		   cache: false,
		   url: _ctx + "/registry/domain_info_get.do",
		   data: {id:id},
		   success: function( content ){
			   $('#data').html( content ); 
			   $('#myModal').modal('show');
		   },
		   error:function(){
			   ui.msg('信息加载错误', 0);
		   }
	});
}

function menuSync(){
	$.ajax({
		   type: "POST",
		   dataType:"json",
		   cache: false,
		   url: _ctx + "/registry/domain_info_sync.do",
		   success: function(resp){
			   if(resp.status == '1'){
				   ui.msg(resp.msg, 1);
				   ui.go(_ctx + '/registry/domain_info_list.do');
			   }else{
				   ui.msg(resp.msg, 0);
			   }
		   },
		   error:function(){
			   ui.msg('信息加载错误', 0);
		   }
	});
}



</script>
</head>
<body>
<%@ include file="/WEB-INF/view/common/topbar.jsp"%>
<div class="main-container" id="main-container">
	<div class="main-container-inner">
		<%@ include file="/WEB-INF/view/common/sidebar.jsp"%>
		<div class="main-content">
				<div class="breadcrumbs" id="breadcrumbs">
					<ul class="breadcrumb">
						<li>
							<i class="icon-home home-icon"></i>
							<a href="#">首页</a>
						</li>
						<li>
							<a href="#">注册管理</a>
						</li>
						<li>
							<a href="#">业务域管理</a>
						</li>
						<li class="active">列表</li>
					</ul>
				 </div>
				 <div class="page-content">
				  	<div class="row">
				  		<div class="col-xs-12">
				  			<div class="widget-box">
				  				<div class="widget-header header-color-white">
									<div class="widget-toolbar no-border">
										<c:if test="${sessionScope._user_session.slAuthFlag eq 1 }">
										  <c:if test="${!netType}">
										   <button class="btn btn-primary btn-xs" onclick="return menuSync()" ><i class="icon-refresh bigger-110"></i> 同步到内网&nbsp;&nbsp;</button>
										   <a class="btn btn-primary btn-xs" href="${ctx}/registry/domain_info_add.do?nodeId=${nodeInfo.id}" ><i class="icon-plus-sign icon-on-right"></i> 注册&nbsp;&nbsp;</a>
										   </c:if>
											
										</c:if>
										<a href="#" data-action="collapse">
											<i class="icon-chevron-up"></i>
										</a>
									</div>
								</div>
					  			<div class="widget-body">
									<div class="widget-main">
									  	<form  id="searchForm" class="form-search"  action="${ctx }/registry/domain_info_list.do" method="post"  onsubmit="return search(this)">
										 <div class="row">
										   <div class="col-xs-4">
											  <div class="input-group">
											    <span class="input-group-addon">业务域名称</span>
											    <input type="text" class="form-control search-query" name="searchName" id="searchName" value="${param.searchName}"/>
											    <span class="input-group-btn">
															<button type="submit" class="btn btn-purple btn-sm" onclick="return formSubmit();">
																<i class="icon-search icon-on-right bigger-110"></i>
																搜索
															</button>
												</span>
											  </div>
										  </div>
										   <div class="col-xs-4">
													<div class="input-group">
														
													</div>
												</div>
												</div>
										</form>
									</div>
								</div>
						</div>
				  	<div class="hr hr12 hr-dotted"></div>
				  	<div class="table-responsive">
					<table class="table table-striped table-bordered table-hover">
					  <thead>
				        <tr>
							<th class="center" >序号</th>
							<th>业务域编码</th>
							<th>业务域名称</th>
							<th>管理节点</th>
							<th>修改时间</th>
							<th >操作</th>
				        </tr>
					    </thead>
						<tbody>
						<c:forEach var="vo" items="${_data}" varStatus="idx">
						  <tr>
						  	<td class="center">${idx.index + 1}</td>
						  	<td>${vo.code}</td>
							<td>${vo.name}</td>
							<td>${vo.nodeName}</td>
							<td>${si:fmtDate(vo.mtime)}</td>
							<td>
								<div class="visible-md visible-lg hidden-sm hidden-xs action-buttons">
									<a class="blue" href="javascript:void(0);"  onclick="domainInfoGet('${vo.id }');"title="查看">
										<i class="icon-zoom-in bigger-130"></i>
									</a>
									<c:if test="${sessionScope._user_session.slAuthFlag eq 1 }">
										<c:if test='${nodeAdmin eq 1 }'>
											<c:if test="${vo.nodeId eq nodeInfo.id }"> 
											 <c:if test="${!netType}">
												<a class="green" href="${ctx}/registry/domain_info_update/${vo.id }.do" title="修改">
													<i class="icon-pencil bigger-130"></i>
												</a>
												<a style="display: none;" class="red"  href="javascript:void(0);" onclick="deleteById('${vo.id }')" title="删除">
													<i class="icon-trash bigger-130"></i> 
												</a>
												</c:if>
											</c:if>
										</c:if>
									</c:if>
								</div>
								<div id="myModal" class="modal fade" role="dialog"  tabindex="-1" aria-labelledby="查看" aria-hidden="false">
									<div class="modal-dialog">
										<div class="modal-content">
											<div class="modal-header">
									      </div>
											<div   id="data">
								  			</div>
											<div class="modal-footer wizard-actions">
												<button class="btn btn-danger btn-sm pull-left" data-dismiss="modal">
													<i class="icon-remove"></i>
													关闭
												</button>
											</div>
										</div>
									</div>
								</div>
							</td>
						  </tr>
						</c:forEach>
						</tbody>
					</table>
					<jsp:include page="/WEB-INF/view/common/pg.jsp">
						<jsp:param value="${ctx }/registry/domain_info_list.do" name="url"/>
						<jsp:param value="${_total}" name="total"/>
						<jsp:param value="${_urlpara}" name="urlpara" />
				    </jsp:include>
				  		</div>
					</div>
				</div>
			</div>
		</div>
	</div>
</div>
</body>
</html>
